import 'package:flutter/cupertino.dart';

class ShareDataWidget<T> extends InheritedWidget {

  const ShareDataWidget({super.key, required super.child, required this.data});

  final T data;

  static ShareDataWidget of(BuildContext context) {
    print("=============");
    return context.getElementForInheritedWidgetOfExactType<ShareDataWidget>()!.widget as ShareDataWidget;
  }

  @override
  bool updateShouldNotify(covariant ShareDataWidget<T> oldWidget) {
    throw oldWidget.data != data;
  }
}